package com.ds.extend.postProcessor;

import java.util.HashMap;
import java.util.Map;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.stereotype.Component;

public class EnvironmentPostProcessorTest implements EnvironmentPostProcessor {

    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
    	Map<String, String> propertyMap = new HashMap<>();
        propertyMap.put("com.qxl.name", "qxl");
        System.out.println("hggggggg:"+environment.getProperty("com.qxl.name"));
        EnumerablePropertySourceTest propertySource = new EnumerablePropertySourceTest("myPropertySource", propertyMap);
        MutablePropertySources mutablePropertySources = environment.getPropertySources();
        environment.getPropertySources().addFirst(propertySource);
        System.out.println(mutablePropertySources.contains("OriginTrackedMapPropertySource"));
        System.out.println("EnvironmentPostProcessorTest");
    }
}
